package com.gherasoft.model;

import android.widget.BaseAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * User: sckomoroh
 * Date: 3/12/13
 * Time: 8:05 PM
 */
public class ListsModel
{
    private List<String> lists = new ArrayList<String>();
    private BaseAdapter adapter;

    public ListsModel(BaseAdapter adapter)
    {
        this.adapter = adapter;
    }

    public void addItem(String item)
    {
        this.lists.add(item);
        this.adapter.notifyDataSetChanged();
    }

    public void removeItem(int index)
    {
        this.lists.remove(index);
        this.adapter.notifyDataSetChanged();
    }

    public int getCount()
    {
        return this.lists.size();
    }

    public String getItem(int index)
    {
        return this.lists.get(index);
    }

    public void setItem(int index, String item)
    {
        this.lists.set(index, item);
        this.adapter.notifyDataSetChanged();
    }
}
